﻿<UserControl x:Class="ContactTracing.CaseView.Controls.Tabs.HospitalizationTab"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:p="clr-namespace:ContactTracing.CaseView.Properties"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:ContactTracing.CaseView"
             xmlns:vm="clr-namespace:ContactTracing.ViewModel;assembly=ContactTracing.ViewModel"
             xmlns:controls="clr-namespace:ContactTracing.CaseView.Controls"
             xmlns:wpf="clr-namespace:ContactTracing.Controls;assembly=ContactTracing.WPF"
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             mc:Ignorable="d" 
             d:DesignHeight="310" d:DesignWidth="1079">
    <Grid x:Name="gridHospitalizations" VerticalAlignment="Stretch" Background="{StaticResource mainPanelBackgroundBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <StackPanel Grid.Row="0" Margin="10,5,0,5">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <!--<TextBlock Grid.Column="0" Style="{StaticResource Heading1}" Text="{x:Static p:Resources.IsolatedPatientsHeading}" />-->
                <!--<Image Grid.Column="1" Width="20" Height="20" Margin="20,0,20,0" Source="..\..\Images\word.png" Cursor="Hand" MouseDown="outcomeFormPrint_Click"/>-->
                <Button Click="outcomeFormPrint_Click" Margin="10,0,10,0" HorizontalAlignment="Right" Style="{StaticResource ResourceKey=BacklessButtonStyle}">
                    <Button.Content>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Path Grid.Column="1" Width="20" Height="25" Margin="6, 2, 0, 2" Stretch="Fill" Fill="Black" Data="F1 M 52,34L 39,34L 39,21L 24,21L 24,55L 52,55L 52,34 Z M 55.9999,59L 20,59L 20,17L 43.25,17L 55.9999,29.75L 55.9999,59 Z M 43,22.25L 43,30L 50.7499,30L 43,22.25 Z M 31,53L 31,45L 34,45C 35.6569,45 37,45.8431 37,47.5C 37,49.1569 35.6569,50 34,50L 33,50L 33,53L 31,53 Z M 34,48C 34.5523,48 35,48.0523 35,47.5C 35,46.9477 34.5523,47 34,47L 33,47L 33,48L 34,48 Z M 45,53L 45,45L 50,45L 50,47L 47,47L 47,48L 49,48L 49,50L 47,50L 47,53L 45,53 Z M 38,45L 41,45C 42.6569,45 44,46.3431 44,48L 44,50C 44,51.6568 42.6569,53 41,53L 38,53L 38,45 Z M 42,50L 42,48C 42,47.4477 41.5523,47 41,47L 40,47L 40,51L 41,51C 41.5523,51 42,50.5523 42,50 Z "/>
                            <!--<Path HorizontalAlignment="Center" Grid.Row="0" Margin="6, 2, 6, 2" Width="12" Height="12" Stretch="Fill" Fill="{StaticResource RoundedButtonShapeForegroundBrush}" Data="F1 M 25,27L 25,17L 51,17L 51,27L 47,27L 47,21L 29,21L 29,27L 25,27 Z M 16,28L 60,28L 60,51L 52,51L 52,46L 55,46L 55,33L 21,33L 21,46L 24,46L 24,51L 16,51L 16,28 Z M 25,39L 28,39L 28,52L 35,52L 35,59L 48,59L 48,39L 51,39L 51,62L 33,62L 25,54L 25,39 Z M 46,55L 38,55L 38,52L 46,52L 46,55 Z M 46,49L 30,49L 30,46L 46,46L 46,49 Z M 46,43L 30,43L 30,40L 46,40L 46,43 Z "/>-->
                            <!--<Path HorizontalAlignment="Center" Grid.Row="0" Margin="6, 2, 6, 2" Width="24" Height="24" Stretch="Fill" Fill="{StaticResource RoundedButtonShapeForegroundBrush}" Data="F1 M 38,0.791664C 58.5496,0.791664 75.2083,17.4504 75.2083,38C 75.2083,58.5496 58.5496,75.2083 38,75.2083C 17.4504,75.2083 0.791662,58.5496 0.791662,38C 0.791662,17.4504 17.4504,0.791664 38,0.791664 Z M 38,5.54166C 20.0738,5.54166 5.54167,20.0738 5.54167,38C 5.54167,55.9262 20.0738,70.4583 38,70.4583C 55.9262,70.4583 70.4583,55.9262 70.4583,38C 70.4583,20.0738 55.9262,5.54166 38,5.54166 Z "/>-->

                            <TextBlock VerticalAlignment="Center"  HorizontalAlignment="Center" Grid.Column="0" Margin="0, 0, 0, 0" FontSize="8pt" Text="{x:Static p:Resources.PrintPatientOutcomeForm}" />
                        </Grid>
                    </Button.Content>
                </Button>
            </Grid>
            <DockPanel Height="8" />
            <wpf:SearchBox Margin="0, 0, 10, 0" HorizontalAlignment="Right" SearchText="{Binding SearchIsoCasesText,UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" Search="{Binding SearchIsoCases}" />
            <!--<DockPanel Height="8" />-->
        </StackPanel>
        <StackPanel Grid.Column="0" Grid.Row="1" Margin="10,5,10,10">
            <Border Background="{StaticResource DataGridHeaderBackgroundBrush}">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <StackPanel Orientation="Horizontal" Grid.Column="0">
                        <TextBlock Margin="5, 5, 15, 5" FontWeight="SemiBold" FontSize="16" Foreground="{StaticResource DataGridHeaderForegroundBrush}" Text="{x:Static p:Resources.AllIsolatedPatients}" />

                        <TextBlock Margin="5, 5, 0, 5" FontWeight="SemiBold" FontSize="16" Foreground="{StaticResource DataGridHeaderForegroundBrush}">(</TextBlock>
                        <TextBlock Margin="0, 5, 0, 5" FontWeight="SemiBold" FontSize="16" Foreground="{StaticResource DataGridHeaderForegroundBrush}" Text="{Binding Path=IsolatedCollectionView.Count}"></TextBlock>
                        <TextBlock Margin="0, 5, 5, 5" FontWeight="SemiBold" FontSize="16" Foreground="{StaticResource DataGridHeaderForegroundBrush}">)</TextBlock>
                    </StackPanel>
                    <StackPanel Margin="2" Orientation="Horizontal" Grid.Column="1">
                        <!--<Button x:Name="btnPrintOutcomeForm" Margin="1" Width="135" Height="18" Style="{StaticResource FlatButtonStyle}" Click="btnPrintOutcomeForm_Click">
                            <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">Print Outcome Form</TextBlock>
                        </Button>-->

                        <wpf:DarkOnLightCircleButton x:Name="btnPrintList" Margin="1"
                                                         Click="btnPrintHospitalizations_Click"
                                                         Text="{x:Static p:Resources.PrintList}"
                                                         PathData="F1 M 25,27L 25,17L 51,17L 51,27L 47,27L 47,21L 29,21L 29,27L 25,27 Z M 16,28L 60,28L 60,51L 52,51L 52,46L 55,46L 55,33L 21,33L 21,46L 24,46L 24,51L 16,51L 16,28 Z M 25,39L 28,39L 28,52L 35,52L 35,59L 48,59L 48,39L 51,39L 51,62L 33,62L 25,54L 25,39 Z M 46,55L 38,55L 38,52L 46,52L 46,55 Z M 46,49L 30,49L 30,46L 46,46L 46,49 Z M 46,43L 30,43L 30,40L 46,40L 46,43 Z "
                                                         />
                        
                        <!--<Button x:Name="btnAddContact" Margin="1" Style="{StaticResource RoundedButtonStyle}" Click="btnPrintHospitalizations_Click">
                            <Button.Content>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <Path HorizontalAlignment="Center" Grid.Row="0" Margin="6, 2, 6, 2" Width="12" Height="12" Stretch="Fill" Fill="{StaticResource RoundedButtonShapeForegroundBrush}" Data="F1 M 25,27L 25,17L 51,17L 51,27L 47,27L 47,21L 29,21L 29,27L 25,27 Z M 16,28L 60,28L 60,51L 52,51L 52,46L 55,46L 55,33L 21,33L 21,46L 24,46L 24,51L 16,51L 16,28 Z M 25,39L 28,39L 28,52L 35,52L 35,59L 48,59L 48,39L 51,39L 51,62L 33,62L 25,54L 25,39 Z M 46,55L 38,55L 38,52L 46,52L 46,55 Z M 46,49L 30,49L 30,46L 46,46L 46,49 Z M 46,43L 30,43L 30,40L 46,40L 46,43 Z "/>
                                    <Path HorizontalAlignment="Center" Grid.Row="0" Margin="6, 2, 6, 2" Width="24" Height="24" Stretch="Fill" Fill="{StaticResource RoundedButtonShapeForegroundBrush}" Data="F1 M 38,0.791664C 58.5496,0.791664 75.2083,17.4504 75.2083,38C 75.2083,58.5496 58.5496,75.2083 38,75.2083C 17.4504,75.2083 0.791662,58.5496 0.791662,38C 0.791662,17.4504 17.4504,0.791664 38,0.791664 Z M 38,5.54166C 20.0738,5.54166 5.54167,20.0738 5.54167,38C 5.54167,55.9262 20.0738,70.4583 38,70.4583C 55.9262,70.4583 70.4583,55.9262 70.4583,38C 70.4583,20.0738 55.9262,5.54166 38,5.54166 Z "/>

                                    <TextBlock VerticalAlignment="Center"  HorizontalAlignment="Center" Grid.Column="1" Margin="0, 0, 10, 0" FontSize="8pt" Text="{x:Static p:Resources.PrintList}" />
                                </Grid>
                            </Button.Content>
                        </Button>-->

                        <!--<Button x:Name="btnPrintHospitalizations" Margin="1" Width="135" Height="18" Style="{StaticResource FlatButtonStyle}" Click="btnPrintHospitalizations_Click">
                            <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">Print List</TextBlock>
                        </Button>-->
                    </StackPanel>
                </Grid>
            </Border>
            <DataGrid x:Name="dgHospitalizations" 
                      ItemsSource="{Binding IsolatedCollectionView, IsAsync=True, FallbackValue=...}"
                                        IsSynchronizedWithCurrentItem="True"
                  VirtualizingStackPanel.IsVirtualizing="True"
                  VirtualizingStackPanel.VirtualizationMode="Recycling"
                          AutoGenerateColumns="False"
                      CanUserReorderColumns="False"
                      ScrollViewer.PanningMode="Both"
                           Style="{StaticResource DataGridDemoStyle}" MouseDoubleClick="dgHospitalizations_MouseDoubleClick">
                <DataGrid.Columns>
                    <DataGridTemplateColumn Header="Actions">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <controls:CaseActionsRowControl DataContext="{Binding}" 
                                                                ShowPrintButton="True"
                                                                ShowConvertButton="False"
                                                                ShowDeleteButton="False"
                                                                ShowLabButton="False"
                                                                ShowRelationshipButton="False"
                                                                ShowUnlockButton="False"
                                                                    PrintFullFormRequested="carc_PrintFullFormRequested"
                                                                    PrintOutcomeFormRequested="carc_PrintOutcomeFormRequested"
                                                                ListLabSamplesRequested="CaseActionsRowControl_ListLabSamplesRequested"
                                                                     />
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>

                    <DataGridTemplateColumn Header="">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Path Width="12" 
                                          Height="12" 
                                          Stretch="Fill" 
                                          Visibility="{Binding IsLocked, Converter={StaticResource BooleanToVisibilityConverter}, FallbackValue=Collapsed}"
                                        Data="F1 M 22.17,36.4216L 25.3369,36.4216L 25.3369,31.6711C 25.3369,24.6745 31.0087,19.0027 38.0053,19.0027C 45.0019,19.0027 50.6737,24.6745 50.6737,31.6711L 50.6737,36.4216L 53.841,36.4216L 53.8411,57.008L 22.17,57.008L 22.17,36.4216 Z M 45.9231,31.6711C 45.9231,27.2982 42.3782,23.7533 38.0053,23.7533C 33.6324,23.7533 30.0875,27.2982 30.0875,31.6711L 30.0875,36.4216L 45.923,36.4216L 45.9231,31.6711 Z">
                                    <Path.Style>
                                        <Style TargetType="{x:Type Path}">
                                            <Setter Property="Fill" Value="{StaticResource HighlightBrush}" />
                                            <Style.Triggers>
                                                <DataTrigger
                        Binding="{Binding
                            RelativeSource={RelativeSource
                                Mode=FindAncestor,
                                AncestorType={x:Type DataGridCell}},
                                Path=IsSelected}"
                        Value="True">
                                                    <Setter Property="Fill" Value="White"/>
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </Path.Style>
                                </Path>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    
                    <DataGridTextColumn Header="{x:Static p:Resources.ColHeaderID}" Binding="{Binding ID, ValidatesOnDataErrors=False}" IsReadOnly="True"></DataGridTextColumn>
                    <DataGridTextColumn Header="{x:Static p:Resources.ColHeaderOtherID}" Binding="{Binding OriginalID}" IsReadOnly="True"></DataGridTextColumn>
                    <DataGridTextColumn Header="{x:Static p:Resources.ColHeaderSurname}" Binding="{Binding Surname}" IsReadOnly="True"></DataGridTextColumn>
                    <DataGridTextColumn Header="{x:Static p:Resources.ColHeaderOtherNames}" Binding="{Binding OtherNames}" IsReadOnly="True"></DataGridTextColumn>
                    <DataGridTextColumn Header="{x:Static p:Resources.ColHeaderEpiCaseDef}" Binding="{Binding EpiCaseDef, ValidatesOnNotifyDataErrors=False, Converter={StaticResource EpiCaseClassificationConverter}}" IsReadOnly="True"></DataGridTextColumn>
                    <DataGridTextColumn Header="{x:Static p:Resources.ColHeaderGender}" Binding="{Binding Gender, ValidatesOnDataErrors=False, Converter={StaticResource GenderConverter}}" IsReadOnly="True" />
                    <DataGridTextColumn Header="{x:Static p:Resources.ColHeaderAge}" Binding="{Binding AgeYears}" IsReadOnly="True" />
                    <DataGridTextColumn Header="{x:Static p:Resources.ColHeaderHealthFacility}" Binding="{Binding CurrentHospital}" IsReadOnly="True" />
                    <DataGridTextColumn Header="{x:Static p:Resources.ColHeaderOnsetDate}" Binding="{Binding DateOnset, StringFormat='dd/MM/yyyy'}" IsReadOnly="True"></DataGridTextColumn>
                    <DataGridTextColumn Binding="{Binding DateIsolationCurrent, StringFormat='dd/MM/yyyy'}" IsReadOnly="True">
                        <DataGridTextColumn.HeaderTemplate>
                            <DataTemplate>
                                <TextBlock>
                                        Date Admitted
                                    <LineBreak />
                                        to Isolation
                                </TextBlock>
                            </DataTemplate>
                        </DataGridTextColumn.HeaderTemplate>
                    </DataGridTextColumn>
                    <DataGridTextColumn Binding="{Binding DateLastLabSampleCollected, StringFormat='dd/MM/yyyy'}" IsReadOnly="True">
                        <DataGridTextColumn.HeaderTemplate>
                            <DataTemplate>
                                <TextBlock Text="{x:Static p:Resources.ColHeaderDateLastSampleCollected}" />
                            </DataTemplate>
                        </DataGridTextColumn.HeaderTemplate>
                    </DataGridTextColumn>
                    <!--<DataGridTextColumn Header="Sample Interpretation" Binding="{Binding LastSampleInterpretation}" IsReadOnly="True" />-->
                    <DataGridTextColumn Header="{x:Static p:Resources.ColHeaderPCRResultLast}" Binding="{Binding LastSamplePCRResult}" IsReadOnly="True" />
                </DataGrid.Columns>
            </DataGrid>
        </StackPanel>
        
        <!--<controls:PatientOutcomeFormViewer x:Name="docViewer" Grid.RowSpan="100" Visibility="Collapsed" />-->
    </Grid>
</UserControl>
